package org.kmfdm.horrorscope.core.dao.hibernate;

import java.util.List;

import org.hibernate.criterion.Restrictions;
import org.kmfdm.horrorscope.core.dao.ChartDAO;
import org.kmfdm.horrorscope.metamodel.Chart;
import org.kmfdm.horrorscope.metamodel.Customer;
import org.springframework.transaction.annotation.Transactional;


public class ChartDAOHibernate extends GenericDAOHibernate<Chart, Long> implements ChartDAO {

	public Class<Chart> getPersistentClass(){
		return Chart.class;
	}
	@Transactional
	public void createChart(Chart ch){
		saveOrUpdate(ch);	
		
		
	}
	@Transactional
	public List<Chart> getCustomersCharts(Customer c) {
		return search(Restrictions.eq("owner", c));
		
	}
	
}